<include file="Public:_header" />
<link rel="stylesheet" href="weixin_statics/css/easydropdown.metro.css">
<style>.hidden{display:none;}</style>
    <script language="javascript">
        function submit() {
            var flag=true;
            $("#content .gzlist").each(function(index){
                var that=this;
                if($(this).find(".start select").eq(0).val()==0||$(this).find(".start select").eq(1).val()==0||$(this).find(".end select").eq(0).val()==0||$(this).find(".end select").eq(1).val()==0)
                {
                    $(this).find(".error").html("请选择起止年月");
                    $(this).find(".error").show();
                    flag=false;
                }

                if($(this).find(".start select").eq(0).val()>$(this).find(".end select").eq(0).val()&&$(this).find(".start select").eq(1).val()>$(this).find(".end select").eq(1).val())
                {
                    $(this).find(".error").html("起止年月选择错误");
                    $(this).find(".error").show();
                    flag=false;
                }
                $(this).find("select").focus(function(){
                    $(that).find(".error").hide();
                });
            });
            
            if($("input[name='band']").attr('value')=="")
            {$(".band").removeClass('hidden');
                flag=false;
            }else{
                $(".band").addClass('hidden');
                flag = true;
            }
            if($("input[name='position']").attr('value')=="")
            {
                $(".position").removeClass('hidden');
                flag=false;
            }else{
                $(".position").addClass('hidden');
                flag = true;
            }
           if(flag==true)
           {
               $("form").submit();
           }
 
        }
        function initYearMonth(select)
        {
            var date = new Date();//实例化一个日期对象
            var year = date.getFullYear();//获取当前年份
            var month = date.getMonth()+1;//获取当前月份
            var day = date.getDate();//获取当前日

            var start_year=1990;
            var start_month=1;
            var nyear = "{$exper.year}";
            var nmonth = "{$exper.month}";
            var eyear = "{$exper.endyear}";
            var emonth = "{$exper.endmonth}";
            $(select+" [class='year']").append("<option value='0'>请选择年</option>");
             $(select+" [class='endyear']").append("<option value='0'>请选择年</option>");
            for(var i=start_year;i<year;i++)
            {
                if(i == nyear){
                    $(select+" [class='year']").append( "<option value='"+(i)+"' selected>"+(i)+"年</option>");
                }else{
                    $(select+" [class='year']").append( "<option value='"+(i)+"'>"+(i)+"年</option>");
                }
                if(i == eyear){
                    $(select+" [class='endyear']").append( "<option value='"+(i)+"' selected>"+(i)+"年</option>");
                }else{
                    $(select+" [class='endyear']").append( "<option value='"+(i)+"'>"+(i)+"年</option>");
                }
                 
            }
            $(select+" [class='month']").append("<option value='0'>请选择月</option>");
            $(select+" [class='endmonth']").append("<option value='0'>请选择月</option>");
            for(var j=start_month;j<month;j++)
            {
                if(j == nmonth){
                   $(select +" [class='month']").append( "<option value='"+(j)+"' selected>"+(j)+"月</option>"); 
                }else{
                    $(select +" [class='month']").append( "<option value='"+(j)+"'>"+(j)+"月</option>");
                }
                if(j == emonth){
                    $(select +" [class='endmonth']").append( "<option value='"+(j)+"' selected>"+(j)+"月</option>");
                }else{
                    $(select +" [class='endmonth']").append( "<option value='"+(j)+"'>"+(j)+"月</option>");
                }
                
            }
        }
        $(document).ready(function () {
                    initYearMonth("#template .start");
                    initYearMonth("#template .end");

                    $("[name='band']").live("focus",function(){
                        $(this).removeClass("red");
                    });
                    $("[name='band']").live("blur",function(){
                        if($.trim($(this).val()).length==0||$.trim($(this).val()).length>100)
                        {
                            $(this).addClass("red");
                        }
                    });

                    $("[name='position']").live("focus",function(){
                        $(this).removeClass("red");
                    });
                    $("[name='position']").live("blur",function(){
                        if($.trim($(this).val()).length==0||$.trim($(this).val()).length>100)
                        {
                            $(this).addClass("red");
                        }
                    });

                }
        );
    </script>
<form method="post" action="__URL__/add_exper_info">
    <div class="warp">
        <h2 class="ztitle">修改工作经历</h2>

        <div id="content">

        </div>

        
        
    </div>

<div id="template" name="template" style="margin:10px;">
<ul class="zllist gzlist"  >
    <li>起止时间</li>
    <li><span name="start" class="start"><select name="year" class="year">
    </select>&nbsp;<select name="month" class="month">

    </select> </span>&nbsp;到&nbsp;<span name="end" class="end"> <select name="endyear" class="endyear">

    </select>&nbsp;<select name="endmonth" class="endmonth">

    </select>&nbsp;</span><span class="error" style="color: red;display: none; padding-left: 10px;"></span></li>
    <li>所在公司和品牌 <span class="band hidden"><font color="red">请填写完整！</font></span></li>
    <li><input type="" class="text" name="band" value="{$exper.jobname}"/></li>
    <li>任职岗位 <span class="position hidden"><font color="red">请填写完整！</font></span></li>
    <li><input type="" class="text" name="position" value="{$exper.jobzhiwei}"/></li>
    <input type="hidden" value="{$Think.get.id}" name="id" />
    <a class="submit" href="javascript:submit()">保存</a>
</ul>
</div>
</form>
<script src="weixin_statics/js/jquery.easydropdown.js" type="text/javascript"></script>
<include file="./weixin/Tpl/default/public/_bottom.html" />